@extends('layouts.default')
@section('content')
@include('modules.thanhmenu')
<?php
if(HomeController::checkInTime('dssvdk')){
$dssinhvien = new CanBoQLDeTaiVaSVDK();
$dsnienkhoahocky = new HomeController();
$dsnienkhoahocky = $dsnienkhoahocky->nienKhoa();
?>
<br/>
<table width="100%" cellspacing="0" cellpadding="0" border="0">
    <tr>        
        <td align="center" class="brt btop blt title-danhsachhp" style="padding: 5px">
            <form method="get" action="" name="frmLK">
                Niên khóa:
                <select name="txtNienKhoa" id="txtNienKhoaId">
                    <?php
                    foreach ($dsnienkhoahocky as $dsnienkhoahockys) {
                        ?>
                        <option name="<?= $dsnienkhoahockys->nien_khoa ?>" value="<?= $dsnienkhoahockys->nien_khoa ?>" <?php if(Input::get('txtNienKhoa') == $dsnienkhoahockys->nien_khoa) echo "selected='selected'" ?>>
                            <?= $dsnienkhoahockys->nien_khoa ?>
                        </option>
                        <?php
                    }
                    ?>
                </select>&nbsp;
                Học kì: 
                <select name="txtHocKy" id="txtHocKyId">
                    <option  name="txtHocKy" value="1" <?php if(Input::get('txtHocKy') == 1) echo "selected='selected'" ?>>1</option>
                    <option name="txtHocKy" value="2" <?php if(Input::get('txtHocKy') == 2) echo "selected='selected'" ?>>2</option>
                </select>
                <input type="submit" name="butonLK" value="Liệt kê" class="cm_footer exampleDiv" style='color:#fff'/>
            </form>
        </td>
    </tr>
    <?php
    if (isset($_GET['txtNienKhoa']) && isset($_GET['txtHocKy'])) {
        $a = $_GET['txtNienKhoa'];
        $b = $_GET['txtHocKy'];
        $dssinhvien = $dssinhvien->show_svdk(Session::get('infor.id_nd')[0], $a, $b);
    }
    ?>
    <tr>
        <td>
            <table border="0" cellspacing="0" cellpadding="0" width="100%">
                <tr>
                    <td width="100%" align="center" colspan="4" class="cm_footer btop brt bbot" style="color:#fff; font-size: 14px; font-weight: bold"> 
                        Danh Sách Sinh Viên 
                    </td>
                </tr>
                <tr>
                    <td width="10%" align="center" class="title-danhsachhp bbot brt blt" style="padding: 5px;color:#000; font-size: 14px; font-weight: bold">
                        STT
                    </td>
                    <td width="40%" align="center" class="title-danhsachhp bbot brt" style="padding: 5px;color:#000; font-size: 14px; font-weight: bold">
                        Tên Đề Tài 
                    </td>
                    <td width="30%" align="center" class="title-danhsachhp bbot brt" style="padding: 5px;color:#000; font-size: 14px; font-weight: bold">  
                        Tên Sinh Viên
                    </td>
                    <td width="20%" align="center" class="title-danhsachhp bbot brt" style="padding: 5px;color:#000; font-size: 14px; font-weight: bold">  
                        Mã Số Sinh Viên
                    </td>
                </tr>
                <?php
                $stt = 0;
                foreach ($dssinhvien as $dssinhviens) {
                    ?>
                    <tr <?php if ($stt % 2 != 0) echo "style='background:#ccc'" ?> align="center">
                        <td class="blt bbot brt" >
                            <?= ++$stt ?>
                        </td>
                        <td class="bbot brt" >
                            <?= $dssinhviens->ten_de_tai ?>
                        </td>
                        <td class="bbot brt" >
                            <?= $dssinhviens->ho ?>
                            <?= $dssinhviens->ten ?>
                        </td>
                        <td class="bbot brt" >
                            <?= $dssinhviens->mssv ?>
                        </td>
                    </tr>
                    <?php
                }
                    if($stt == 0)
                    {
                        ?>
                        <tr> 
                            <td colspan="4" align="center" class="blt bbot brt" style="padding: 5px">
                                <i>Không có sinh viên đăng ký.</i>
                            </td>
                        </tr>
                    <?php
                    }
                ?>
            </table>
        </td>
    </tr>
</table>
<?php
}
else{
    echo "<script>alert('Chưa tới thời gian xem danh sách sinh viên đăng ký!');location.href='".URL."cb'</script>";
}
?>
@stop


